Component({
  properties: {
    show: {
      type: String
    },
    deviceid: {
      type: String
    }
  },

  data: {
    moduleList: null,
    curShowId: 0
  },
  attached() {
    let moduleList;
    if (wx.getStorageSync('moduleList_new').length) {
      moduleList = wx.getStorageSync('moduleList_new').filter(item => item.moduleID === 'history')[0];
    } else {
      moduleList = wx.getStorageSync('moduleList').filter(item => item.moduleID === 'history')[0];
    }
    console.log('moduleList', moduleList)
    this.setData({
      moduleList,
      curShowId: moduleList.children[0].moduleID
    })
  },
  pageLifetimes: {
    
  },
  methods: {
    dispatchHistory () {
      this.selectComponent(".history-opt") && this.selectComponent(".history-opt").navCheck();
    },
    selectNav(e){
      let item = e.currentTarget.dataset.item;
      if (this.data.curShowId === item.moduleID) return
      this.setData({
        curShowId: item.moduleID
      })
    },
    setNavMargin(e){
      setTimeout(() => {
        this.triggerEvent("setNavMargin", {
          showDialog: e.detail.showDialog
        });
      }, 300)
      
    }
  }
})